#pragma once
#ifndef Gui_h__
#define Gui_h__

#include "Geo.h"
#include "Gfx.h"

#include <eastl/map.h>
#include <eastl/string.h>

typedef intptr_t ID;

struct GUILayout;
typedef bool(*DoLayoutFunc)(GUILayout*,float&,float&,float&,float&);

struct GUILayout
{
	int Type;
	bool Enabled;
	float X, Y, W, H;
	Color BGColor;
	float Data[4];
	void* VData;

	DoLayoutFunc DoFunc;
};

#define STRINGIFY(x) #x
#define STRINGERMACRO( x ) STRINGIFY(x)
#define GUID (intptr_t)(__FILE__ STRINGERMACRO(__LINE__))

enum
{
	GUIFLAG_Disabled = 1,
};

extern eastl::map<eastl::string, Pic> ButtonImages;

ID GetGUIHotItem();
void SetGUIFont(Fnt font);

bool Button(ID guid, float x, float y, const char* text, float w = 64.0f, float h = 48.0f, const Color& color = Color(0.5f,0.5f,0.5f), int flags = 0);

/// Layouts
GUILayout* PushStaticLayout(float x, float y, float w, float h, const Color& bgcolor = Color::Transparent());
void PopLayout();

#endif // Gui_h__